<template>
  <div class="aaaxxx">
    <!-- 返回条 -->
    <van-icon name="arrow-left" @click="fanhui" />
    <!-- 其他 -->
    <div class="asdasd">
      <van-icon name="circle" />
      <van-popover
        v-model="showPopover"
        trigger="click"
        :actions="actions"
        @select="onSelect"
        placement="bottom-end"
      >
        <template #reference>
          <van-icon name="setting-o" v-if="$route.path == '/my'" />
        </template>
      </van-popover>
    </div>
  </div>
</template>

<script>
export default {
  name: "FanHui",
  data() {
    return {
      showPopover: false,
      // 通过 actions 属性来定义菜单选项
      actions: [{ text: "退出登录" }],
    };
  },
  methods: {
    fanhui() {
      this.$router.go(-1);
    },
    onSelect(action) {
      if (action.text == "退出登录") {
        localStorage.removeItem('userxx')
        this.$router.push('/log').catch(r=>{})
      }
    },
  },
};
</script>

<style scoped>
.aaaxxx {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  font-size: 30px;
  background-color: rgb(255, 54, 54);
  color: white;
  padding: 0 10px;
  height: 40px;
}
.asdasd {
  display: flex;
  flex-direction: row;
  width: 80px;
  justify-content: space-around;
}
</style>